#include "manga.h"

Manga::Manga()
{
}
Manga::Manga(int id,QString nom,QString adr)
{
    m_nom = nom;
    m_adresse = adr;
    m_id = id;
}
void Manga::setNom(QString nom)
{
    m_nom = nom;
}
void Manga::setAdresse(QString adr)
{
    m_adresse = adr;
}
QString Manga::nom()
{
    return m_nom;
}
QString Manga::adresse()
{
    return m_adresse;
}
bool Manga::serialize(QXmlStreamWriter * w)
{
    w->writeStartElement("Manga");
    w->writeAttribute("id",QString::number(m_id));
    w->writeAttribute("nom",m_nom);
    w->writeAttribute("adresse",m_adresse);
    w->writeEndElement();
    return true;
}
bool Manga::deserialize(QXmlStreamReader * r)
{
    QXmlStreamAttributes a = r->attributes();
    m_id = ((QXmlStreamAttribute)a.at(0)).value().toString().toInt(0,10);
    m_nom = ((QXmlStreamAttribute)a.at(1)).value().toString();
    m_adresse = ((QXmlStreamAttribute)a.at(2)).value().toString();
    return true;
}
QStringList Manga::getHeaders()
{
    return Resource::getHeaders() << "Nom" << "Adresse";
}
QList<QTableWidgetItem*> Manga::getItems()
{
    return Resource::getItems() << new QTableWidgetItem(nom()) << new QTableWidgetItem(adresse());
}

